package com.sright.bcard.common.service.share.enums;

/**
 * 文本审核记录来源 1：小程序 2：企业后台 3：总后台
 */
public enum SourceTypeEnum {

    APPLET("小程序" , 1),
    ENTERPRISE_BACKEND("企业后台", 2),
    OPERATE_BACKEND("运营后台（总后台）", 3),
    ;
    private String name;

    private Integer code;

    SourceTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static SourceTypeEnum getEnum(String name) {
        try {
            return valueOf(name);
        } catch (Exception e) {
            return null;
        }
    }


    public static SourceTypeEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }

        for (SourceTypeEnum item : SourceTypeEnum.values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    public Integer getValue() {
        return code;
    }

    public void setValue(Integer code) {
        this.code = code;
    }

}
